<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>vue</title>
  </head>
  <body>
  <script src="https://unpkg.com/vue@2.6.14/dist/vue.js"></script>
    <div id="app">
      <input v-model="username">
      <div v-update>
        <div>儿子{{username}}</div>
      </div>
    </div>
    <script>
        Vue.directive('update',{
          update(el){
            console.log('update',el.innerText)
          },
          componentUpdated(el){
            console.log('componentUpdated',el.innerText)
          }
        });
        var vm = new Vue({
            el:'#app',
            data:{username:''}
        })
    </script>
  </body>
</html>
